<template>
	<!-- 评论块 -->
	<view class="di_block">
		<view class="di_le">
			<!-- <navigator url="../discuss/discuss" class="di_item discuss">					
				<text>8</text>
			</navigator> -->
			<view class="di_item share">
				<button open-type="share" class="share_button"><text>{{thisdata.text4}}</text></button>
			</view>
		</view>
		<view class="di_ri">
			<view :class="['di_item','collect',collectOn?'active':'']" @click="collectCut">					
				<text>{{thisdata.text2}}</text>				
			</view>
			<view :class="['di_item','like',likeOn?'active':'']" @click="likeCut">					
				<text>{{thisdata.text3}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"discuss",
		props:{		
			//当前数据
			thisdata:{ 
				required:true,
				type:Object,
				default:function(){
					return {}
				}
			},
			//数据ID
			thisid:Number
		},
		data() {
			return {
				collectOn:false,//收藏
				likeOn:false, //点赞
			};
		},
		methods:{
			//put 当前id数据
			putThisIdData(){
				this.$http({
					url:'d_list',
					method:'put',
					data:this.thisdata
				})
			},
			//收藏点击
			collectCut(){		
				this.collectOn = !this.collectOn	
				if(this.collectOn){
				   this.thisdata.text2 = parseInt(this.thisdata.text2) + 1				   
				}else{
				   this.thisdata.text2 = parseInt(this.thisdata.text2) - 1
				}			
				this.putThisIdData();				
			},
			//点赞点击
			likeCut(){				
				this.likeOn = !this.likeOn
				if(this.likeOn){
				   this.thisdata.text3 = parseInt(this.thisdata.text3) + 1
				}else{
				   this.thisdata.text3 = parseInt(this.thisdata.text3) - 1
				}			
				this.putThisIdData();
			}
		},
		onShareAppMessage(res) {
			if (res.from === 'button') {// 来自页面内分享按钮
			  //console.log(res.target)
			}
			return {
			  title: '星河集团旗下儿童乐园品牌，近2000㎡亲子家庭休闲娱乐体验空间，30+互动玩法给您带来奇妙有趣的体验。',
			  imageUrl:'http://124.71.81.168:91/serves/images/1625737106547s-620-506-236374434878092692739387006.jpg',
			  path: '/pages/images/images'
			}
		}
	}
</script>

<style lang="scss">
	.share_button {border:0px;background-color: #fff;box-shadow: 0;font-size:14px;color:#666;}
	.share_button::after {
	  border: none;
	}
	.di_block {position: fixed;bottom:0;left:0;width:100%;height:100rpx;z-index: 910;overflow: hidden;border-top:1px solid #eee;background:#fff;}
	.di_le {position: absolute;left:2%;top:12rpx;}
	.di_ri {position: absolute;right:2%;top:12rpx;}
	.di_item {position: relative;float: left;margin:0 18rpx;
		text {padding:16rpx 0;padding-left:60rpx;display: block;}
		.share_button {position: relative;padding:0}
	}
	.di_item text {height:40rpx;line-height: 40rpx;}
 	.di_item.discuss text {background:url(@/static/images/a1_3.png) no-repeat left;background-size:46rpx;}
	.di_item.share text {background:url(@/static/images/a1_4.png) no-repeat left;background-size:46rpx;}
	.di_item.collect text {background:url(@/static/images/a1_5.png) no-repeat left;background-size:52rpx;}
	.di_item.like text {background:url(@/static/images/a1_1.png) no-repeat left;background-size:50rpx;}
	.di_item.collect.active text {background:url(@/static/images/a1_6.png) no-repeat left;background-size:52rpx;}
	.di_item.like.active text {background:url(@/static/images/a1_2.png) no-repeat left;background-size:50rpx;}
	.di_ico {width:46rpx;height:46rpx;position: relative;top:12rpx;margin-right:10rpx}
</style>
